package com.fili.gui.components.graph;

import com.fili.core.storage.DataItemType;

import java.awt.*;
import java.io.Serializable;

/**
 * Created by Claudiu-Florin FILIMON
 * Date: Oct 21, 2006
 * Time: 11:06:13 PM
 */
public class DataGraphConfig implements Serializable
{
    private boolean[] visibility;
    private Color[] colors;


    public DataGraphConfig()
    {
        int n = DataItemType.getNumValues();
        visibility = new boolean[n];
        colors = new Color[n];

        for (int i = 0; i < n; i++)
        {
            visibility[i] = true;
//            colors[i] = new Color((i/9)*80, ((i%9)/3)*80, (i%3)*80);
            colors[i] = new Color(0xfff000 / n * i + 0xfff);
        }
    }

    public boolean isVisible(DataItemType.Index i)
    {
        return visibility[i.ordinal()];
    }

    public void setVisible(DataItemType.Index i, boolean visible)
    {
        visibility[i.ordinal()] = visible;
    }

    public Color getColor(DataItemType.Index i)
    {
        return colors[i.ordinal()];
    }

    public void setColor(DataItemType.Index i, Color color)
    {
        colors[i.ordinal()] = color;
    }
}
